using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace DataLayerTest.Models.Mapping
{
    public class OutdoorExerciseSocial_CheerMessageMap : EntityTypeConfiguration<OutdoorExerciseSocial_CheerMessage>
    {
        public OutdoorExerciseSocial_CheerMessageMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("OutdoorExerciseSocial_CheerMessage");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.IdExercise).HasColumnName("IdExercise");
            this.Property(t => t.IdMessage).HasColumnName("IdMessage");
            this.Property(t => t.IdSender).HasColumnName("IdSender");
            this.Property(t => t.Datetime).HasColumnName("Datetime");

            // Relationships
            this.HasRequired(t => t.OutdoorExerciseSocial)
                .WithMany(t => t.OutdoorExerciseSocial_CheerMessage)
                .HasForeignKey(d => d.IdExercise);
            this.HasRequired(t => t.Player)
                .WithMany(t => t.OutdoorExerciseSocial_CheerMessage)
                .HasForeignKey(d => d.IdSender);

        }
    }
}
